/*
 * Copyright (C) 2017-2021
 * All rights reserved, Designed By
 * Copyright authorization contact 18814114118
 */
package com.shop.cereshop.app.dao.order;

import com.shop.cereshop.app.page.cart.CartSku;
import com.shop.cereshop.commons.domain.order.CereOrderProduct;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface CereOrderProductDAO extends BaseMapper<CereOrderProduct> {

    List<CartSku> findOrderProductSku(@Param("orderId") Long orderId);

    List<CereOrderProduct> findByOrderIds(List<Long> orderIdList);

    List<CartSku> findProductStatsByOrderIds(List<Long> orderIdList);

    /**
     * 更新订单商品的核销信息
     * @param orderId 订单ID
     * @param skuId 商品规格ID
     * @param writeNumber 核销数量
     * @param writeCode 核销码
     */
    void updateWriteOffInfo(@Param("orderId") Long orderId,
                            @Param("skuId") Long skuId,
                            @Param("writeNumber") Integer writeNumber,
                            @Param("writeCode") String writeCode);
}
